package com.swt.controller.S_controller;

import com.alibaba.fastjson.JSON;
import com.swt.domain.Employee;
import com.swt.service.impl.S_impl.GetSupportPersonalServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class GetSupportPersonalController  {
    /*注入services*/
    @Resource(name = "S_getSupportPersonalService")
    private GetSupportPersonalServiceImpl getSupportPersonalService;
    /*获取所有支持私教的controller*/
    @RequestMapping("/S_getSupportPersonal")
    @ResponseBody
    public String getSupportPersonal(int clubid){
        /*调用service*/
        System.out.println(clubid);
        List<Employee> list = getSupportPersonalService.getSupportPersonal(clubid);
        String empolyeelist=JSON.toJSONString(list);
        return empolyeelist;
    }

    /*根据Id获取对应的私教信息*/
    @RequestMapping("/S_getSupportPersonalById")
    @ResponseBody
    public String getSupportPersonalById(int employeeId){
        System.out.println(employeeId);
        /*调用service*/
        Employee employee = getSupportPersonalService.getSupportPersonalById(employeeId);
        String employee1=JSON.toJSONString(employee);
        return employee1;
    }
}
